package com.waterdispenser.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Locale;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 *
 * @TableName t_student
 */
@TableName(value ="t_student")
@Data
@AllArgsConstructor
public class TStudent implements Serializable {
    /**
     * 编号
     */
    @TableId(value = "num", type = IdType.AUTO)
    private Long num;

    /**
     * 学生校园卡号
     */
    @TableField(value = "card_number")
    private Long cardNumber;

    /**
     * 机器id
     */
    @TableField(value = "id")
    private Long id;

    /**
     * 饮水时间
     */
    @TableField(value = "drinking_time")
    private LocalDateTime drinkingTime;

    /**
     * 饮水量
     */
    @TableField(value = "water_intake")
    private Integer waterIntake;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TStudent other = (TStudent) that;
        return (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
            && (this.getCardNumber() == null ? other.getCardNumber() == null : this.getCardNumber().equals(other.getCardNumber()))
            && (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDrinkingTime() == null ? other.getDrinkingTime() == null : this.getDrinkingTime().equals(other.getDrinkingTime()))
            && (this.getWaterIntake() == null ? other.getWaterIntake() == null : this.getWaterIntake().equals(other.getWaterIntake()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
        result = prime * result + ((getCardNumber() == null) ? 0 : getCardNumber().hashCode());
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDrinkingTime() == null) ? 0 : getDrinkingTime().hashCode());
        result = prime * result + ((getWaterIntake() == null) ? 0 : getWaterIntake().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", num=").append(num);
        sb.append(", cardNumber=").append(cardNumber);
        sb.append(", id=").append(id);
        sb.append(", drinkingTime=").append(drinkingTime);
        sb.append(", waterIntake=").append(waterIntake);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
